<!-- include tpl=head_lay nopadding=true overflowy=true -->
<script type="text/javascript">
function test_link()
{
	var url = "{url ctrl=plugin func=exec id=collection exec=collection_url tid=$tid/}"
	var linkurl = $("#testing_linkurl").val();
	if(!linkurl){
		$.dialog.alert("请输入要测试的采集网址");
		return false;
	}
	url += "&listurl="+$.str.encode(linkurl);
	$.dialog.tips('正在执行中…');
	$.phpok.json(url,test_link_ajax);
}
function test_link_ajax(rs)
{
	if(rs && rs.status == 'ok'){
		var info = rs.content;
		var array = new Array();
		for(var i in info){
			array[i] = info[i].url;
		}
		$("#content").val(array.join("\n"));
	}else{
		if(rs){
			$("#content").val(rs.content);
		}
	}
}


function test_msg()
{
	var url = "{url ctrl=plugin func=exec id=collection exec=collection_content tid=$tid/}"
	var linkurl = $("#testing_linkurl").val();
	if(!linkurl){
		$.dialog.alert("请输入要测试的采集网址");
		return false;
	}
	url += "&msgurl="+$.str.encode(linkurl);
	$.dialog.tips('正在执行中…');
	$.phpok.json(url,test_msg_ajax)
}

function test_msg_ajax(rs)
{
	if(rs && rs.status == 'ok'){
		var info = rs.content;
		var array = new Array();
		for(var i in info){
			array[i] = info[i].title+"（"+info[i].identifier+"）："+info[i].content;
		}
		$("#content").val(array.join("\n"));
	}else{
		if(rs){
			$("#content").val(rs.content);
		}
	}
}

</script>
<style type="text/css">
.cj_result{font-size:12px;line-height:150%;}
</style>
<div class="layui-card">
	<div class="layui-card-body layui-form">
		<div class="layui-form-item">
			<label class="layui-form-label">
				网址
			</label>
			<div class="layui-input-inline long-auto">
				<input type="text" id="testing_linkurl" class="layui-input">
			</div>
			<div class="layui-input-inline auto gray lh38">
				<div class="layui-btn-group">
					<input type="button" value="采集网址" onclick="test_link()" class="layui-btn layui-btn-sm" />
					<input type="button" value="采集内容" onclick="test_msg()" class="layui-btn layui-btn-sm" />
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">
				结果
			</label>
			<div class="layui-input-block">
				<textarea id="content" class="cj_result" style="width:100%;height:440px;max-height:440px;min-height:440px;border:1px solid #ccc;resize:none;"></textarea>
			</div>
			<div class="layui-input-block mtop"></div>
		</div>
	</div>
</div>


<!-- include tpl=foot_lay is_open=true -->